<?php
class Captcha{
	/**
	 * 显示验证码
	 * @return void
	 */
	public function showCaptcha()
	{		
		require_once SOURCE_EXT_PATH . 'library/CaptchaLib.php';
		$code = CaptchaLib::getCode ();
		UserSession::setCaptcha($code);
		CaptchaLib::showImage ( $code );
	}
	
	/**
	 * 检查验证码
	 * @param string $inputCaptch
	 * @return string
	 */
	public function checkCaptcha($inputCaptch)
	{
		$code = UserSession::getCaptcha ();
		UserSession::clearCaptcha ();
		return strtolower ( $inputCaptch ) == strtolower ( $code );
	}
}